package com.bbz.crawler.controller;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.plugins.Page;
import com.bbz.crawler.core.commen.model.BbzSeq;
import com.bbz.crawler.service.IBbzSeqService;
/**
 * <p>
 * BbzSeqController
 * </p>
 *
 * @author binbin.a.zhang123
 * @since 2018-05-29
 */
@RestController
@RequestMapping("/bbzSeq")
public class BbzSeqController  {

    @Autowired
    private IBbzSeqService bbzSeqService;

    /**
     * 跳转到添加页面BbzSeq
     */
    @RequestMapping("/addBbzSeq")
    public String bbzSeqAdd() {
        return  "addBbzSeq.html";
    }

    /**
     * 跳转到编辑页面BbzSeq
     */
    @RequestMapping("/editBbzSeq/{bbzSeqId}")
    public String editBbzSeq(@PathVariable Integer bbzSeqId, ModelMap model) {
        BbzSeq bbzSeq = bbzSeqService.selectById(bbzSeqId);
        model.addAttribute("item",bbzSeq);
        return "editBbzSeq.html";
    }

    /**
     * 获取BbzSeq列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(String condition) {
        return bbzSeqService.selectList(null);
    }

  	/**
     * 获取BbzSeq列表
     */
    @RequestMapping(value = "/list/page/{page}/size/{size}")
    @ResponseBody
    public Object listPage(@PathVariable Integer page, @PathVariable Integer size) {
        return bbzSeqService.selectMapsPage(new Page<>(page, size), null);
    }
    
    /**
     * 新增BbzSeq
     */
    @RequestMapping(value = "/add")
    public Object add(BbzSeq bbzSeq) {
        bbzSeqService.insert(bbzSeq);
        return null;
    }

    /**
     * 删除BbzSeq
     */
    @RequestMapping(value = "/delete")
    public Object delete(@RequestParam Integer bbzSeqId) {
        bbzSeqService.deleteById(bbzSeqId);
        return null;
    }

    /**
     * 修改BbzSeq
     */
    @RequestMapping(value = "/update")
    public Object update(BbzSeq bbzSeq) {
        bbzSeqService.updateById(bbzSeq);
        return null;
    }

    /**
     * BbzSeq详情
     */
    @RequestMapping(value = "/detail/{bbzSeqId}")
    public Object detail(@PathVariable("bbzSeqId") Integer bbzSeqId) {
        return bbzSeqService.selectById(bbzSeqId);
    }
}
